{% extends "base.html" %}
{% load szachy_tags %}
{% block content %}


{% if me.games %}
<h1>
  Your current games:
</h1>
 
  {% for game in me.games %}
   
    <div class="span-17 last{% ifequal game.get_my_state "u" %}  box{% endifequal %}{% ifequal game.current_move me.id %} box{% endifequal %}">{% game_tag game %}
    
    
    {% if not game.is_started %}
    <a href="{{ game.decline_url }}">Decline</a>
    <a href="{% url game game_id=game.id %}">Show</a>
    {% else %}
      {% ifequal uid game.current_move %}
      <a href="{% url game game_id=game.id %}">Make move</a>
      {% else %}
      <a href="{% url game game_id=game.id %}">Show</a>
      {% endifequal %}
    {% endif %}
    </div>
    
  
  {% endfor %}
   <div class="clearfix"></div>
  
{% else %}
<h2>
  {{ me.name }} you have no current games
</h2>
{% endif %}

{% if me.games_history %}
<h2>Last ten games:</h2>

  {% for game in me.games_history %}
  <div class="span-17 last">
    {% game_tag game %} {{ game.get_state_display }} 
    <div class="span-2 last"><a href="{% url game_result game_id=game.id %}">Show</a></div>
  </div>    
  {% endfor %}

{% endif %}
{% endblock %}


